/**
 * ---------------------------------------- *
 * 省份选择组件 v1.0
 * ---------------------------------------- *
 * */

/**
 * input:   		选择省份的输入框id
 * idTT：           保存省份ID的名字
 * parentId:        父级Id,若为空，则显示所有数据
 * boxId:		弹出框ID			
 * isLowerLevel：	是否调用下一级，'yes'调用，no或''不调用
 * lowerData：		下一级参数数据，当isLowerLevel为yes时，须传参数数据
 */
//<input type="text" id="provinceId" name="provinceId" value=""/>
//<input type="text" class="addressinput" id="provinceTT" value="省份"/>
//new AddressProvince.addressSelector({input:'provinceTT', idTT:'provinceId', parentId:1, boxId: 'provinceDiv'});
//new AddressProvince.addressSelector({input:'provinceTT', idTT:'provinceId', parentId:1, isLowerLevel：'no'});
//new AddressProvince.addressSelector({input:'provinceTT', idTT:'provinceId', parentId:1, isLowerLevel：'yes', lowerData:'下一级参数数据'});

var AddressProvince = {};
var AddressHotCity = {};

AddressProvince.datas = {'addressData':[
]};

AddressHotCity.datas = {'addressData':[
]};

/**
 * 从后台获取下级数据
 */
AddressProvince.getAddressData = function(argsData){
	$.ajax({
		url : '/service/address/data/province/'+argsData.countyCode+'/'+argsData.langCode,
		type : 'get',
		dataType : 'json',
		contentType: 'application/x-www-form-urlencoded; charset=utf-8',
		success : function(data) {
			//sat data
			AddressProvince.datas.addressData = data.provinceData;
			AddressHotCity.datas.addressData = data.hotCityData;
		    
			AddressProvince.oaddress = {hot:{},address:{}};
			var addresss = AddressProvince.datas;
		    var n = addresss.addressData.length;
		    for (var i = 0; i < n; i++) {
		        var letter = 'ZZ';
				if(addresss.addressData[i].abb){
					letter=addresss.addressData[i].abb.substring(0,2).toUpperCase();
				}
		        var tmp = addresss.addressData[i].parentId;
		    	if(tmp == null)  tmp = "pp";

		    	//名字－id－父id
		        var match = addresss.addressData[i].name + "^" + addresss.addressData[i].id + "^" + tmp;
		        if (!AddressProvince.oaddress.address[letter]) 
		        	AddressProvince.oaddress.address[letter] = [];
		        AddressProvince.oaddress.address[letter].push(match);
		    }
		    
		    /* 热门城市 */
		    var hotCity = AddressHotCity.datas;
			if(typeof hotCity.addressData != undefined && hotCity.addressData != '' && hotCity.addressData != null){
			    var hn = hotCity.addressData.length; 
			    for (var i = 0; i < hn; i++) {
			        //名字－id－父id
			        var match = hotCity.addressData[i].name + "^" + hotCity.addressData[i].id + "^" + hotCity.addressData[i].parentId;
			        if(!AddressProvince.oaddress.hot['hot']) 
			        	AddressProvince.oaddress.hot['hot'] = [];
			        AddressProvince.oaddress.hot['hot'].push(match);
			    }
			}
		    new AddressProvince.addressSelector(argsData);
		},
		error : function() {
			sfAlert(i18n.province_handle_data);
		}
	});
	
	
};

/**
 * 静态方法集
 * @name _m
 * */
AddressProvince._m = {
    /* 选择元素 */
    $:function (arg, context) {
        var tagAll, n, eles = [], i, sub = arg.substring(1);
        context = context || document;
        if (typeof arg == 'string') {
            switch (arg.charAt(0)) {
                case '#':
                    return document.getElementById(sub);
                    break;
                case '.':
                    if (context.getElementsByClassName) return context.getElementsByClassName(sub);
                    tagAll = AddressProvince._m.$('*', context);
                    n = tagAll.length;
                    for (i = 0; i < n; i++) {
                        if (tagAll[i].className.indexOf(sub) > -1) eles.push(tagAll[i]);
                    }
                    return eles;
                    break;
                default:
                    return context.getElementsByTagName(arg);
                    break;
            }
        }
    },

    /* 绑定事件 */
    on:function (node, type, handler) {
        node.addEventListener ? node.addEventListener(type, handler, false) : node.attachEvent('on' + type, handler);
    },

    /* 获取事件 */
    getEvent:function(event){
        return event || window.event;
    },

    /* 获取事件目标 */
    getTarget:function(event){
        return event.target || event.srcElement;
    },

    /* 获取元素位置 */
    getPos:function (node) {
        var scrollx = document.documentElement.scrollLeft || document.body.scrollLeft,
                scrollt = document.documentElement.scrollTop || document.body.scrollTop;
        var pos = node.getBoundingClientRect();
        return {top:pos.top + scrollt, right:pos.right + scrollx, bottom:pos.bottom + scrollt, left:pos.left + scrollx };
    },

    /* 添加样式名 */
    addClass:function (c, node) {
        if(!node)return;
        node.className = AddressProvince._m.hasClass(c,node) ? node.className : node.className + ' ' + c ;
    },

    /* 移除样式名 */
    removeClass:function (c, node) {
        var reg = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");
        if(!AddressProvince._m.hasClass(c,node))return;
        node.className = reg.test(node.className) ? node.className.replace(reg, '') : node.className;
    },

    /* 是否含有CLASS */
    hasClass:function (c, node) {
        if(!node || !node.className)return false;
        return node.className.indexOf(c)>-1;
    },

    /* 阻止冒泡 */
    stopPropagation:function (event) {
        event = event || window.event;
        event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true;
    },
    
    /* 去除两端空格 */
    trim:function (str) {
        return str.replace(/^\s+|\s+$/g,'');
    }
};

/* 正则表达式 筛选中文地点名、拼音、首字母 */
AddressProvince.regEx = /^([\u4E00-\u9FA5\uf900-\ufa2d]+)\|(\w+)\|(\w)\w*$/i;
AddressProvince.regExChiese = /([\u4E00-\u9FA5\uf900-\ufa2d]+)/;

/* 地点HTML模板 */
AddressProvince._template = [
];

/**
 * 地点控件构造函数
 * @addressSelector
 * */
AddressProvince.addressSelector = function () {
    this.initialize.apply(this, arguments);
};

//清空下级，下下级
AddressProvince.clearLowerData = function (isLowerLevelEx, lowerDataEx) {
	if(isLowerLevelEx == 'yes'){
		//clear city data
    	document.getElementById(lowerDataEx.idTT).value = '';
    	document.getElementById(lowerDataEx.input).value = '';
    	
    	AddressCity.clearLowerData(lowerDataEx.isLowerLevel, lowerDataEx.lowerData);
    }
};


/**
 * 删除已创建province div
 */
AddressProvince.removeBox = function(boxId){
	var provinceBox = document.getElementById(boxId);
	if(provinceBox != null){
		document.body.removeChild(provinceBox);
	}
};

AddressProvince.addressSelector.prototype = {
    constructor:AddressProvince.addressSelector,

    /* 初始化 */
    initialize :function (options) {
    	//box div id
    	this.boxId = options.boxId;

    	AddressProvince.removeBox(this.boxId);
    	AddressProvince.clearLowerData();
    	
    	//输入值
    	var input = options.input;
        this.input = AddressProvince._m.$('#'+ input);
        
        //地点id
        var idTT = options.idTT;
        this.addressId = AddressProvince._m.$('#'+ idTT);
        
        //是否调用下一级
        this.isLowerLevel = options.isLowerLevel;
        if(this.isLowerLevel == 'yes'){
        	//获取下一级参数数据
        	this.lowerData = options.lowerData;
        }
        
        this.countyCode=options.countyCode;
        
        this.langCode=options.langCode;
        //设置城市变更函数	
        this.changeFunc = options.changeFunc;
        //创建box
        this.inputEvent();
        this.createWarp();
        this.closeAdress();
        //设置input值,若有下级，调用
        if(this.setInput()){
        	return ;
        }
    },
    
    /**
     * 关闭显示
     */
    closeAdress:function(){
    	var that = this;
    	AddressProvince._m.addClass('hide',that.addressBox);
    	/* 点击地点名的时候隐藏myIframe */
    	AddressProvince._m.addClass('hide',that.myIframe);
    },
    
    /**
     * 设置input值,若有下级，调用
     */
    setInput:function(){
    	var that = this;
    	var idVal = that.addressId.value;
    	if(idVal != null && idVal != ''){
    		var provinceData = AddressProvince.datas.addressData;
            var n = provinceData.length;
            for (var i = 0; i < n; i++) {
            	if(provinceData[i].id == idVal){
            		that.input.value = provinceData[i].name;
            		break;
            	}
            }
    		
    		//若有下一级,则调用下一级
            if(that.isLowerLevel == 'yes'){
            	var ppId = that.addressId.value + '/' + that.input.value;
            	var lowerArgsData;
        		var lowerInput = that.lowerData.input;
        		var lowerIdTT = that.lowerData.idTT;
        		var lowerBoxId = that.lowerData.boxId;
        		var lowerIsLowerLevel = that.lowerData.isLowerLevel;
        		var countyCode = that.countyCode;
        		var langCode = that.langCode;
        		if(lowerIsLowerLevel == 'yes'){//有下下级
        			//下下级数据
        			var lowerLowerData = that.lowerData.lowerData;
        			
        			//调用下一级
        			lowerArgsData = {parentInput:that.input,input:lowerInput, idTT:lowerIdTT, parentId:ppId, boxId:lowerBoxId, isLowerLevel:lowerIsLowerLevel, lowerData:lowerLowerData,changeFunc:that.lowerData.changeFunc,countyCode:countyCode,langCode:langCode};
        		}else{
        			//调用下一级
        			lowerArgsData = {parentInput:that.input,input:lowerInput, idTT:lowerIdTT, parentId:ppId, boxId:lowerBoxId,changeFunc:that.lowerData.changeFunc,countyCode:countyCode,langCode:langCode};
        		}
        		AddressCity.getAddressData(lowerArgsData);
        	}
          //城市值变更调用
            if(!AddressHelper.isEmpty(that.changeFunc) && !AddressHelper.isEmpty(idVal)){
            	that.changeFunc.call(this,idVal);
            }
            return true;
    	}
    	
    	return false;
    },

    /**
     * @createWarp
     * 创建地点BOX HTML 框架
     * */
    createWarp:function(){
    	var that = this;
    	var div = document.getElementById(that.boxId);
        if(div == null){
        	var inputPos = AddressProvince._m.getPos(that.input);
        	div = this.rootDiv = document.createElement('div');
        	
        	// 设置DIV阻止冒泡
        	AddressProvince._m.on(this.rootDiv,'click',function(event){
        		AddressProvince._m.stopPropagation(event);
        	});
        	
        	// 设置点击文档隐藏弹出的地点选择框
        	AddressProvince._m.on(document, 'click', function (event) {
        		event = AddressProvince._m.getEvent(event);
        		var target = AddressProvince._m.getTarget(event);
        		if(target == that.input) 
        			return false;
        		if (that.addressBox)
        			AddressProvince._m.addClass('hide', that.addressBox);
        		if (that.ul)
        			AddressProvince._m.addClass('hide', that.ul);
        		if(that.myIframe)
        			AddressProvince._m.addClass('hide',that.myIframe);
        	});
        	
        	div.className = 'addressSelector';
        	div.id = that.boxId;
        	div.style.position = 'absolute';
        	div.style.left = inputPos.left + 'px';
        	div.style.top = inputPos.bottom + 'px';
        	div.style.zIndex = 999999;
        	
        	// 判断是否IE6，如果是IE6需要添加iframe才能遮住SELECT框
        	var isIe = (document.all) ? true : false;
        	var isIE6 = this.isIE6 = isIe && !window.XMLHttpRequest;
        	if(isIE6){
        		var myIframe = this.myIframe =  document.createElement('iframe');
        		myIframe.frameborder = '0';
        		myIframe.src = 'about:blank';
        		myIframe.style.position = 'absolute';
        		myIframe.style.zIndex = '-1';
        		this.rootDiv.appendChild(this.myIframe);
        	}
        	
        	var childdiv = this.addressBox = document.createElement('div');
        	childdiv.className = 'addressBox';
        	childdiv.id = 'addressBox';
        	childdiv.innerHTML = AddressProvince._template.join('');
        	div.appendChild(childdiv);
        }
        this.createAddress();
    },

    /**
     * TAB下面HTML生成，DOM操作
     **/
    createAddress:function(){
        var oaddress = AddressProvince.oaddress;
        for(var key in oaddress){
            var oul = document.createElement('ul');
            if(key == 'hot'){
            	oul.className = 'hot_address clearfix';
            }else if(key == 'address'){
            	oul.className = 'clearfix addctiy_list';
            }
            
            var sortKey=[];
            for(var ckey in oaddress[key]){
                sortKey.push(ckey);
                // ckey按照ABCDEDG顺序排序
                sortKey.sort();
            }
           
            var k = sortKey.length;
            for(var j=0; j<k; j++){
            	var n=oaddress[key][sortKey[j]].length;
                for(var i=0; i<n; i++){
                	//名字－id－父id
                	var tmp = oaddress[key][sortKey[j]][i].split('^');
            		var str = '<a href="javascript:void(0);" name="';
            		if(sortKey[j] == 'hot'){
            			str += 'hot_';
            		}else{
            			//直辖市特殊处理。北京,上海,天津,重庆
            			if(tmp[0].substring(0,2) == '北京' || 
            					tmp[0].substring(0,2) == '上海' ||
            					tmp[0].substring(0,2) == '天津' ||
            					tmp[0].substring(0,2) == '重庆' ||
//            					tmp[0].substring(0,2) == 'BeiJing' ||
//            					tmp[0].substring(0,2) == 'ShangHai' ||
//            					tmp[0].substring(0,2) == 'TianJin' ||
//            					tmp[0].substring(0,2) == 'ZhongQing' ||
            					tmp[0].substring(0,2) == '重慶'){
            				str += 'municipality_';
            			}else{
            				str += 'common_';
            			}
            		}
            		str += tmp[0] + '_' + tmp[1] + '_' + tmp[2] + '_' + '"';
            		if(sortKey[j] == 'hot'){
            			str += ' style="color: #FF6600"';
            		}
            		str += ">" + tmp[0];
            		str += '</a>';
            		if(tmp[0].length == 2){
            			if(navigator.userAgent.indexOf("MSIE")>0){
            				str += "&nbsp;&nbsp;";
            			}
            			if(navigator.userAgent.indexOf("Firefox")>0){ 
            				str += "&nbsp;&nbsp;&nbsp;";
            		   } 

            		}
            		
            		var oli = document.createElement('li');
            		oli.innerHTML = str;
            		oul.appendChild(oli);
                }
            }
            
            this.addressBox.appendChild(oul);
        }
        document.body.appendChild(this.rootDiv);
        /* IE6 */
        this.changeIframe();

        this.linkEvent();
    },

    /**
     * 地点LINK事件
     *  @linkEvent
     * */
    linkEvent:function(){
        var links = AddressProvince._m.$('a',this.addressBox);
        var that = this;
        for(var i=0,n=links.length;i<n;i++){
            links[i].onclick = function(){
            	that.closeAdress();
            	AddressProvince.clearLowerData(that.isLowerLevel, that.lowerData);
            	var tmp = this.name.split("_");
            	if(tmp[0] == 'hot'){//点热门城市,执行下面
        			//设置热门城市的上一级
        			var ppk = tmp[3].split("/");
        			that.addressId.value = ppk[0];
        			that.input.value = ppk[1];
            	}else{//非热门城市
            		that.input.value = tmp[1];
            		that.addressId.value = tmp[2];
            	}
            	
            	var pcId = that.addressId.value + '/' + that.input.value;
            	
            	//若有下一级,则调用下一级
        		if(that.isLowerLevel == 'yes'){
        			var lInput = that.lowerData.input;
        			var lIdTT = that.lowerData.idTT;
        			var lBoxId = that.lowerData.boxId;
        			var lIsLowerLevel = that.lowerData.isLowerLevel;
        			var countyCode = that.countyCode;
            		var langCode = that.langCode;
        			if(lIsLowerLevel == 'yes'){//有下下级
        				//下下级数据
        				var llData = that.lowerData.lowerData;
        				
        				var lArgsData;
        				if(tmp[0] != 'common'){//点热门城市,执行下面
            				//设置城市
        					AddressProvince._m.$('#'+ lIdTT).value = tmp[2];
        					AddressProvince._m.$('#'+ lInput).value = tmp[1] + ((langCode!=getLanCode()&&"en"==langCode)?"":i18n.shi);

        					var paId = tmp[2] + '/' + tmp[1];
        					
            	            //调用下下一级
            	            var llInput = llData.input;
            	            var llIdTT = llData.idTT;
            	            var llBoxId = llData.boxId;
                 			var llArgsData = {input:llInput, idTT:llIdTT, parentId:paId, boxId:llBoxId,countyCode:countyCode,langCode:langCode};
                 			AddressArea.getAddressData(llArgsData);
        				}
        				
        				//调用下一级
        	            lArgsData = {parentInput:that.input,input:lInput, idTT:lIdTT, parentId:pcId, boxId:lBoxId, isLowerLevel:lIsLowerLevel, lowerData:llData,changeFunc:that.lowerData.changeFunc,countyCode:countyCode,langCode:langCode};
        			}else{
        				//do nothing;
        				lArgsData = {};
        			}
        			AddressCity.getAddressData(lArgsData);
        		}
        		if(!AddressHelper.isEmpty(that.changeFunc)){
                	that.changeFunc.call(this,that.addressId.value);
                }
        		return false;
            };
        }
    },

    /**
     * INPUT地点输入框事件
     * @inputEvent
     * */
    inputEvent:function(){
        var that = this;
        AddressProvince._m.on(this.input,'click',function(event){
            event = event || window.event;
            if(!that.addressBox){
                that.createWarp();
            }else if(!!that.addressBox && AddressProvince._m.hasClass('hide',that.addressBox)){
                // slideul 不存在或者 slideul存在但是是隐藏的时候 两者不能共存
                if(!that.ul || (that.ul && AddressProvince._m.hasClass('hide',that.ul))){
                    AddressProvince._m.removeClass('hide',that.addressBox);

                    /* IE6 移除iframe 的hide 样式 */
                    AddressProvince._m.removeClass('hide',that.myIframe);
                    that.changeIframe();
                }
            }
        });
        AddressProvince._m.on(this.input,'focus',function(){
        	that.closeAdress();
            that.input.select();
//            AddressProvince.clearLowerData(that.isLowerLevel, that.lowerData);
        });
        AddressProvince._m.on(this.input,'blur',function(){
        });
        AddressProvince._m.on(this.input,'keyup',function(event){
            event = event || window.event;
            var keycode = event.keyCode;
            AddressProvince._m.addClass('hide',that.addressBox);
            that.createUl();

            /* 移除iframe 的hide 样式 */
            AddressProvince._m.removeClass('hide',that.myIframe);

            // 下拉菜单显示的时候捕捉按键事件
            if(that.ul && !AddressProvince._m.hasClass('hide',that.ul) && !that.isEmpty){
                that.KeyboardEvent(event,keycode);
            }
        });
        AddressProvince._m.on(this.input,'keydown',function(event){
            event = event || window.event;
            var keycode = event.keyCode;
            if(keycode == 9){
            	that.closeAdress();
            }
        });
    },

    /**
     * 生成下拉选择列表
     * @ createUl
     * */
    createUl:function () {
        var val = AddressProvince._m.trim(this.input.value);
        var len = val.length;
        var addresss = AddressProvince.datas;
        // 当val不等于空的时候执行
        if (val !== '') {
            // 此处需设置中文输入法也可用onpropertychange
            var searchResult = [];
            var n = addresss.addressData.length;
            for (var i = 0; i < n; i++) {
        		//搜索只要跟中文和拼音一样，则显示
				if(addresss.addressData[i].abb){
	            	if(val == addresss.addressData[i].abb.substring(0,len) || val == addresss.addressData[i].spell.substring(0,len) || val == addresss.addressData[i].name.substring(0,len)){
	            		var str = '<li';
	            		if (searchResult.length == 0) {
	            			str += ' class="on"';
	                    } 
	            		str += '>';
	            		str += '<b  name="' + addresss.addressData[i].id + '" class="addressname">' + addresss.addressData[i].name + '</b>';
	            		str += '<b class="addressspell">' + addresss.addressData[i].abb + '</b>';
	            		str += '<b class="addressspell">' + addresss.addressData[i].spell + '----</b>';
	            		str += '</li>';
	            		searchResult.push(str);
	            	}
				}
            }
            
            this.isEmpty = false;
            // 如果搜索数据为空
            if (searchResult.length == 0) {
                this.isEmpty = true;
                str = '<li class="empty">对不起，没有找到数据 "<em>' + val + '</em>"</li>';
                
                //id为空
                this.addressId.value = "";
                
                searchResult.push(str);
            }
            // 如果slideul不存在则添加ul
            if (!this.ul) {
                var ul = this.ul = document.createElement('ul');
                ul.className = 'addressslide';
                this.rootDiv && this.rootDiv.appendChild(ul);
                // 记录按键次数，方向键
                this.count = 0;
            } else if (this.ul && AddressProvince._m.hasClass('hide', this.ul)) {
                this.count = 0;
                AddressProvince._m.removeClass('hide', this.ul);
            }
            this.ul.innerHTML = searchResult.join('');

            /* IE6 */
            this.changeIframe();

            // 绑定Li事件
            this.liEvent();
        }else{
            AddressProvince._m.addClass('hide',this.ul);
            AddressProvince._m.removeClass('hide',this.addressBox);
            AddressProvince._m.removeClass('hide',this.myIframe);

            this.changeIframe();
        }
    },

    /* IE6的改变遮罩SELECT 的 IFRAME尺寸大小 */
    changeIframe:function(){
        if(!this.isIE6)return;
        this.myIframe.style.width = this.rootDiv.offsetWidth + 'px';
        this.myIframe.style.height = this.rootDiv.offsetHeight + 'px';
    },

    /**
     * 特定键盘事件，上、下、Enter键
     * @ KeyboardEvent
     * */
    KeyboardEvent:function(event,keycode){
        var lis = AddressProvince._m.$('li',this.ul);
        var len = lis.length;
        switch(keycode){
            case 40: //向下箭头↓
                this.count++;
                if(this.count > len-1) this.count = 0;
                for(var i=0;i<len;i++){
                    AddressProvince._m.removeClass('on',lis[i]);
                }
                AddressProvince._m.addClass('on',lis[this.count]);
                break;
            case 38: //向上箭头↑
                this.count--;
                if(this.count<0) this.count = len-1;
                for(i=0;i<len;i++){
                    AddressProvince._m.removeClass('on',lis[i]);
                }
                AddressProvince._m.addClass('on',lis[this.count]);
                break;
            case 13: // enter键
                this.input.value = AddressProvince.regExChiese.exec(lis[this.count].innerHTML)[0];
                AddressProvince._m.addClass('hide',this.ul);
                AddressProvince._m.addClass('hide',this.ul);
                /* IE6 */
                AddressProvince._m.addClass('hide',this.myIframe);
                break;
            default:
                break;
        }
    },

    /**
     * 下拉列表的li事件
     * @ liEvent
     * */
    liEvent:function(){
        var that = this;
        var lis = AddressProvince._m.$('li',this.ul);
        for(var i = 0,n = lis.length;i < n;i++){
            AddressProvince._m.on(lis[i],'click',function(event){
                event = AddressProvince._m.getEvent(event);
                var target = AddressProvince._m.getTarget(event);
                
                //获得li中html
                var tmp = target.innerHTML;
                
                //获地点ID
            	that.addressId.value = tmp.split('name="')[1].split('"')[0];
            	
            	//获得地点名字
            	var addressName = tmp.split('>')[1].split('<')[0];
            	that.input.value = addressName;
            	
                AddressProvince._m.addClass('hide',that.ul);
                /* IE6 下拉菜单点击事件 */
                AddressProvince._m.addClass('hide',that.myIframe);
                
                //若有下一级,则调用下一级
                if(that.isLowerLevel == 'yes'){
                	var pcId = that.addressId.value + '/' + that.input.value;
                	
                	var lowerArgsData;
            		var lowerInput = that.lowerData.input;
            		var lowerIdTT = that.lowerData.idTT;
            		var lowerBoxId = that.lowerData.boxId;
            		var lowerIsLowerLevel = that.lowerData.isLowerLevel;
            		var countyCode = that.countyCode;
            		var langCode = that.langCode;
            		if(lowerIsLowerLevel == 'yes'){//有下下级
            			//下下级数据
            			var lowerLowerData = that.lowerData.lowerData;
            			
            			//调用下一级
            			lowerArgsData = {parentInput:that.input,input:lowerInput, idTT:lowerIdTT, parentId:pcId, boxId:lowerBoxId, isLowerLevel:lowerIsLowerLevel, lowerData:lowerLowerData,changeFunc:that.lowerData.changeFunc,countyCode:countyCode,langCode:langCode};
            		}else{
            			//调用下一级
            			lowerArgsData = {parentInput:that.input,input:lowerInput, idTT:lowerIdTT, parentId:pcId, boxId:lowerBoxId,changeFunc:that.lowerData.changeFunc,countyCode:countyCode,langCode:langCode};
            		}
            		AddressCity.getAddressData(lowerArgsData);
            	}
            });
            AddressProvince._m.on(lis[i],'mouseover',function(event){
                event = AddressProvince._m.getEvent(event);
                var target = AddressProvince._m.getTarget(event);
                AddressProvince._m.addClass('on',target);
            });
            AddressProvince._m.on(lis[i],'mouseout',function(event){
                event = AddressProvince._m.getEvent(event);
                var target = AddressProvince._m.getTarget(event);
                AddressProvince._m.removeClass('on',target);
            });
        }
    }
};